﻿using System;
using Company.IO.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Company.System.IO.IntegrationTests
{
    public partial class DirectoryTest : TestBase<IDirectory>
    {
        private const string _SSetLastWriteTimeUtcMethodName = "SetLastWriteTimeUtc";

        [TestMethod]
        public void SetLastWriteTimeUtc_PathValid_LastWriteTimeUtc()
        {
            //Arrange
            string path = string.Format("{0}ZEIT\\", SLocalPath);
            var expected = new DateTime(2011, 12, 13, 14, 15, 16);
            global::System.IO.Directory.CreateDirectory(path);

            //Act
            Directory.SetLastWriteTimeUtc(path, expected);

            //Assert
            DateTime actual = global::System.IO.Directory.GetLastWriteTimeUtc(path);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void SetLastWriteTimeUtc_PathNull_ArgumentNullException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, DateTime>();
            object[] parameterValues = GetValueArray(SStringNull, DateTime.Now);
            //Act
            ExpectException<ArgumentNullException>(_SSetLastWriteTimeUtcMethodName, parameterTypes, parameterValues);
            //Assert
        }

        [TestMethod]
        public void SetLastWriteTimeUtc_PathEmpty_ArgumentException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, DateTime>();
            object[] parameterValues = GetValueArray(string.Empty, DateTime.Now);
            //Act
            ExpectException<ArgumentException>(_SSetLastWriteTimeUtcMethodName, parameterTypes, parameterValues);
            //Assert
        }
    }
}